package com.ideal.frame.node.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ideal.frame.entity.AutoModel;
import com.ideal.frame.prefix.entity.PrefixNetxTb;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;


import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author: zhangdelei
 * @date: 2021/8/24-4:27 下午
 * @Description:
 **/
@Data
@Entity
@Table(name = "node_tb")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class NodeTb extends AutoModel implements Serializable, Cloneable {
    /**
     * 节点名称
     */
    private String nodename;
    /**
     * 节点ip
     */
    private String nodeip;
    /**
     * 节点类型;0为真实节点；1为虚拟节点
     */
    private Integer nodetype;
    /**
     * 节点级别;0为根节点；1为一级节点；2为二级节点；3为三级节点
     */
    private Integer nodelevel;
    /**
     * 节点插入时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date insertdate;
    /**
     * 节点更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedate;
    /**
     * 删除标志
     */
    private Boolean isdelete;
    /**
     * 是否同步的数据
     */
    private Boolean issync;
    /**
     * 节点服务端口
     */
    private Integer nodeport;
    /**
     * netty端口
     */
    private Integer nettyport;
    /**
     * 是否检测netty服务端
     */
    private Boolean nettymonitor;

    private boolean status;

    @NotFound(action = NotFoundAction.IGNORE)
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "prefix_id")
    private PrefixNetxTb prefix;

    private String prefixNext;

    private Long syncId;

    private String syncSourcePrefix;
}
